package com.ruoyi.hkCamera.common;

import com.sun.jna.Structure;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;

public class HIKSDKStructure extends Structure {
    protected List<String> getFieldOrder() {
        List<String> fieldOrderList = new ArrayList<>();
        Class<?> cls = getClass();
        for (; !cls.equals(HIKSDKStructure.class);
             cls = cls.getSuperclass()) {
            Field[] fields = cls.getDeclaredFields();
            for (Field field : fields) {
                int modifiers = field.getModifiers();
                if (!Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers))
                    fieldOrderList.add(field.getName());
            }
        }
        return fieldOrderList;
    }
}
